<!--
*Author：DGZ
 *Contact：jiduxiong@dagongzao.com
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *业务请在@/extension/mdsproject/mds_dataserve/Mds_DataServe.jsx此处编写
 -->
<template>
    <view-grid ref="grid"
               :columns="columns"
               :detail="detail"
               :details="details"
               :editFormFields="editFormFields"
               :editFormOptions="editFormOptions"
               :searchFormFields="searchFormFields"
               :searchFormOptions="searchFormOptions"
               :table="table"
               :extend="extend">
    </view-grid>
</template>
<script>
    import extend from "@/extension/mdsproject/mds_dataserve/Mds_DataServe.jsx";
    import { ref, defineComponent } from "vue";
    export default defineComponent({
        name: "Mds_DataServe",
        setup() {
            const table = ref({
                key: "DataServeId",
                footer: "Foots",
                cnName: "数据采集服务",
                name: "mds_dataserve/Mds_DataServe",
                newTabEdit: false,
                url: "/Mds_DataServe/",
                sortName: "DataServeId"
            });
            const editFormFields = ref({"ServeType":"","ServeName":"","Ip":"","Port":"","BaseUrl":"","IsAutoRead":"","ReadInterval":"","ReadRequestData":"","Remarks":""});
            const editFormOptions = ref([[{"title":"服务名","field":"ServeName"},
                               {"dataKey":"enabled","data":[],"title":"服务类型","field":"ServeType","type":"select"},
                               {"title":"IP地址","field":"Ip"},
                               {"title":"端口","field":"Port","type":"number"}],
                              [{"title":"请求基础路径","field":"BaseUrl"},
                               {"dataKey":"enabled","data":[],"title":"自动读取","field":"IsAutoRead","type":"switch"},
                               {"title":"自动读取间隔","field":"ReadInterval","type":"number"}],
                              [{"title":"自动读取请求内容","field":"ReadRequestData","colSize":6,"type":"textarea"},
                               {"title":"备注","field":"Remarks","colSize":6,"type":"textarea"}]]);
            const searchFormFields = ref({"ServeType":""});
            const searchFormOptions = ref([[{"dataKey":"enabled","data":[],"title":"服务类型","field":"ServeType","type":"select"}]]);
            const columns = ref([{field:"DataServeId",title:"ID",type:"bigint",width:110,hidden:true,readonly:true,require:true,showOverflowTooltip:true,align:"left"},
                       {field:"ServeType",title:"服务类型",type:"int",bind:{ key:"enabled",data:[]},width:110,hidden:true,showOverflowTooltip:true,align:"left"},
                       {field:"ServeTypeTxt",title:"服务类型",type:"string",width:90,readonly:true,require:true,showOverflowTooltip:true,align:"left"},
                       {field:"ServeName",title:"服务名",type:"string",link:true,width:150,showOverflowTooltip:true,align:"left"},
                       {field:"Ip",title:"IP地址",type:"string",width:120,showOverflowTooltip:true,align:"left"},
                       {field:"Port",title:"端口",type:"int",width:70,showOverflowTooltip:true,align:"left"},
                       {field:"BaseUrl",title:"请求基础路径",type:"string",width:170,showOverflowTooltip:true,align:"left"},
                       {field:"IsAutoRead",title:"自动读取",type:"int",bind:{ key:"enabled",data:[]},width:70,showOverflowTooltip:true,align:"left"},
                       {field:"ReadInterval",title:"自动读取间隔",type:"int",width:90,showOverflowTooltip:true,align:"left"},
                       {field:"ReadRequestData",title:"自动读取请求内容",type:"string",width:150,hidden:true,showOverflowTooltip:true,align:"left"},
                       {field:"IsValid",title:"是否有效",type:"int",width:110,hidden:true,require:true,showOverflowTooltip:true,align:"left"},
                       {field:"CreateId",title:"创建用户",type:"bigint",width:80,hidden:true,showOverflowTooltip:true,align:"left"},
                       {field:"Creator",title:"创建人",type:"string",width:100,hidden:true,showOverflowTooltip:true,align:"left"},
                       {field:"CreateTime",title:"创建时间",type:"datetime",width:110,hidden:true,showOverflowTooltip:true,align:"left"},
                       {field:"ModifyId",title:"修改用户",type:"bigint",width:80,hidden:true,showOverflowTooltip:true,align:"left"},
                       {field:"Modifier",title:"修改人",type:"string",width:100,showOverflowTooltip:true,align:"left"},
                       {field:"ModifyTime",title:"修改时间",type:"datetime",width:110,showOverflowTooltip:true,align:"left"},
                       {field:"Remarks",title:"备注",type:"string",width:150,showOverflowTooltip:true,align:"left"}]);
            const detail = ref(  {
                    cnName: "服务配置",
                    table: "Mds_DataServeConfig",
                    columns: [{field:"DataServeConfigId",title:"ID",type:"bigint",width:110,hidden:true,readonly:true,require:true,showOverflowTooltip:true,align:"left"},
                       {field:"DataServeId",title:"服务ID",type:"bigint",width:150,hidden:true,showOverflowTooltip:true,align:"left"},
                       {field:"DbBlock",title:"数据块-PLC",type:"string",width:180,edit:{type:""},showOverflowTooltip:true,align:"left"},
                       {field:"ReadLength",title:"读取长度-PLC",type:"int",width:110,edit:{type:""},showOverflowTooltip:true,align:"left"},
                       {field:"HttpName",title:"请求名-Http",type:"string",width:150,edit:{type:""},showOverflowTooltip:true,align:"left"},
                       {field:"HttpPath",title:"请求地址-Http",type:"string",width:180,edit:{type:""},showOverflowTooltip:true,align:"left"},
                       {field:"HttpMethod",title:"请求方法-Http",type:"string",width:180,edit:{type:""},showOverflowTooltip:true,align:"left"},
                       {field:"TcpName",title:"指令名称",type:"string",width:180,edit:{type:""},showOverflowTooltip:true,align:"left"},
                       {field:"TcpContent",title:"指令发送内容",type:"string",width:150,edit:{type:""},showOverflowTooltip:true,align:"left"},
                       {field:"IsValid",title:"是否有效",type:"int",width:110,hidden:true,require:true,showOverflowTooltip:true,align:"left"},
                       {field:"CreateId",title:"创建用户",type:"bigint",width:80,hidden:true,showOverflowTooltip:true,align:"left"},
                       {field:"Creator",title:"创建人",type:"string",width:100,hidden:true,showOverflowTooltip:true,align:"left"},
                       {field:"CreateTime",title:"创建时间",type:"datetime",width:110,hidden:true,showOverflowTooltip:true,align:"left"},
                       {field:"ModifyId",title:"修改用户",type:"bigint",width:80,hidden:true,showOverflowTooltip:true,align:"left"},
                       {field:"Modifier",title:"修改人",type:"string",width:100,hidden:true,showOverflowTooltip:true,align:"left"},
                       {field:"ModifyTime",title:"修改时间",type:"datetime",width:110,hidden:true,showOverflowTooltip:true,align:"left"},
                       {field:"Remarks",title:"备注",type:"string",width:150,hidden:true,showOverflowTooltip:true,align:"left"}],
                    sortName: "DataServeConfigId",
                    key: "DataServeConfigId"
                                            });
            const details = ref([]);
            return {
                table,
                extend,
                editFormFields,
                editFormOptions,
                searchFormFields,
                searchFormOptions,
                columns,
                detail,
                details
            };
        },
    });
</script>
